import java.util.Arrays;
import java.util.Scanner;

public class Main1453 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        for (int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        Arrays.sort(arr);
        double s=0;
        for (int i=1;i<arr.length-1;i++){
            s+=arr[i];
        }
        System.out.println(String.format("%.1f",s/(n-2)));
        for (int i=1;i<arr.length-1;i++){
            System.out.print(arr[i]+" ");
        }
    }
}
